home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
comm
/
ca29_1.zip
/
INSTALL.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1992-11-16
|
22KB
|
679 lines
SET TTHRU OFF ; Must be 1st line to suppress typethrough
ON ESCAPE GOSUB Escape ; Exit if ESC
;**** TRACE ON ; Debugging
;
; ----- COM-AND INSTALL script for automatic execution
; Commenced: 10/90 R.McG
; -----------------------------------------------------------------------
; Purpose:
; This script, named INSTALL.CMD, is executed automatically by
; COM-AND after the load-time creation of the DFT file. It may be
; manually invoked through the F2 window at any time, as well.
; -----------------------------------------------------------------------
;
; Initialization
;
LEGEND "Welcome..."
SET RDISP OFF ; Ignore received chars
;
; Establish a DWINDOW, and change the text display to window default.
; .. Save the previous text display attribute, for restoration later.
;
DWIND 1,2 22,78 ; Establish scrolling region
N99 = "_TEXT" ; Save original text attr
SET TEXT "_DEFA" ; Set text attr
;
; Perform tasks
;
Again:
GOSUB Intro ; Paint intro screen
GOSUB Set ; Look at autoexec file
GOSUB Port ; Select port for default use
GOSUB Speed ; Select speed for default use
GOSUB Type ; Select modem type
GOSUB Update ; Ending "do it again?" query
IF FAILED GOTO Again
;
; Save current settings
;
SET TEXT N99 ; Reset text attr for store
STORE DEFAULT ; Update defaults
GOTO Almost ; Skip Escape tests
;
; Escape was hit - if runtime invocation, do the CODA.
;
Escape:
IF STRCMP "_RUNT" "NO" GOTO Exit
;
; Last words
;
Almost:
ON ESCAPE GOSUB EXIT ; New ESC processor
SET TEXT "_DEFA" ; Set text attr
GOSUB Coda ; Ending last words
;
; Exit the script
;
Exit:
SET TEXT N99 ; Reset text attr finally
DWINDOW CLEAR ; Clear any scrolling region
CLEAR ; Clear entire text window
EXIT
;
; ----- Subroutine: Intro -> introductory screen
; .. note: BOX instead of WOPEN is used - allowing global ESC
;
Intro:
BOX 0,0 23,79 (default)
ATSAY 0,2 (default) " INSTALL intro "
ATSAY 23,25 (default) " Press ESC to cancel INSTALL "
LOCATE 2,2
MESS " ▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓ ▓▓ ▓▓ ▓▓▓▓▓▓▓ "
MESS " ▓▓ ▓▓ ▓▓ ▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓ "
MESS " ▓▓ ▓▓ ▓▓ ▓▓ ▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓ ▓▓ ▓▓ ▓▓ "
MESS " ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓ ▓▓ ▓ ▓▓ ▓▓ ▓▓ "
MESS " ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓ ▓▓ ▓▓ ▓▓ "
MESS " ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓▓ ▓▓ ▓▓ "
MESS " ▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓▓▓▓▓▓ "
MESS " "
;
; Add introductory text
;
IF STRCMP "_RUNT" "YES"
MESS "COM-AND has created a file named COM-AND.DFT for default values. This means"
MESS "that this is the first time COM-AND has executed under these conditions. A"
MESS "script (INSTALL.CMD) included with the COM-AND release will help install the"
MESS "settings you will use in this and subsequent COM-AND sessions."
ELSE
MESS "You have invoked INSTALL.CMD to change COM-AND's default settings. INSTALL"
MESS "simplifies 1) adding/changing a COM-AND= environment variable to the AUTO-"
MESS "EXEC.BAT, 2) setting modem port and type, and 3) setting operating values"
MESS "for this and subsequent COM-AND sessions."
ENDIF
MESS " "
MESS "In order to use this script, you will need to know a few facts about your PC"
MESS "and its configuration. You will need to know the boot drive, the modem port"
MESS "and the type of modem you will be using. This script will help you decide"
MESS "these matters (as much as it is able) and change the DFT file accordingly."
MESS " "
MESS "You may skip this installation script by pressing ESC now (or anytime during"
MESS "the installation). Press any other key to continue..."
;
; Wait for a keypress
;
KEYGET S0 ; Wait for it
RETURN ; And we're done
;
; ----- Subroutine: Set -> Inform of update autoexec.bat with COM-AND=
;
Set:
ENVIRON S0 "COM-AND=" ; Look for pre-existing COM-AND= environ var
IF FOUND GOTO Already ; If it exists, ask if its to be changed
;
; Paint a screen
;
BOX 0,0 23,79 (default)
ATSAY 0,2 (default) " Boot config "
ATSAY 23,25 (default) " Press ESC to cancel INSTALL "
LOCATE 2,2
MESS "COM-AND works best if a single subdirectory is used for COM-AND files and"
MESS "scripts. COM-AND is executing currently from the subdirectory: "
MESS " "
MESS "_SUBD"
MESS " "
MESS "COM-AND looks for files and scripts 1) in the subdirectory it finds at run-"
MESS "time, and if not there 2) in the subdirectory pointed out by the environment"
MESS "variable 'COM-AND='. If COM-AND's working subdirectory is indicated by that"
MESS "environment variable, COM-AND may be executed in ANY subdirectory and still"
MESS "find scripts and files."
MESS " "
MESS "You may use this script to update your AUTOEXEC.BAT file to SET the environ-"
MESS "ment variable, or skip this step."
MESS " "
MESS "Select S)kip, U)pdate, or ESCape (escape cancels this script): "
;
; Wait for a keypress
;
GET S0 1 ; Wait for a char
SWITCH S0 ; Switch on the return
CASE "S" ; S)kip
ENDCASE
CASE "U" ; U)pdate
GOSUB Autoexec ; Do the update
ENDCASE
DEFAULT ; Any other selection
SOUND 100,100
GOTO Set
ENDCASE
ENDSWITCH
RETURN ; And continue
;
; ----- Error: Open a window, display a message, and exit
; S0 passes the error message
;
Error:
WOPEN 10,10,12,70 (contrast)
ATSAY 10,12 (contrast) " Error "
ATSAY 11,12 (contrast) S0(0:55); Max msg width 55 chars
ATSAY 12,26 (contrast) " Press any key to continue "
;
; Wait a keypress
;
KEYGET S0 ; Wait for any key
WCLOSE
RETURN
;
; ----- Subroutine: Autoexec -> update autoexec.bat with COM-AND=
;
Autoexec:
BOX 0,0 23,79 (default)
ATSAY 0,2 (default) " AUTOEXEC update "
ATSAY 23,25 (default) " Press ESC to cancel INSTALL "
LOCATE 2,2
MESS "Please enter the drive letter (A,B,C...) from which your PC is booted. If"
MESS "a diskette is used for boot, please see that the boot disk is in that drive."
MESS " "
MESS "Select drive: A,B,C...: "
;
; Wait for a keypress
;
GET S0 1 ; Wait for a char
IF NOT ALPHA S0
SOUND 100,100
GOTO Autoexec
ENDIF
;
; Look for an autoexec.bat file on that drive
;
S1 = S0*":\AUTOEXEC.BAT"
IF ISFILE S1 GOTO Auto200
;
; Missing autoexec.bat
;
MESS " "
MESS "No AUTOEXEC.BAT file was found on the indicated drive. One will be created"
MESS "if you wish, or you may try another drive."
MESS " "
MESS "Select C)reate, A)nother-drive, or ESCape (escape cancels this script): "
;
; Wait for a keypress
;
GET S0 1 ; Wait for a char
SWITCH S0 ; Switch on the return
CASE "C" ; C)reate
GOTO AUTO100
ENDCASE
CASE "A" ; A)nother
GOTO Autoexec ; Do it again
ENDCASE
DEFAULT ; Any other selection
SOUND 100,100
GOTO Autoexec
ENDCASE
ENDSWITCH
;
; Create AUTOEXEC... get parameter for the subdirectory
;
Auto100:
GOSUB GetSetVal
;
; Create it
;
FOPENO S1 TEXT ; Open for output
IF FAILED ; If open failed
S0 = "Error opening "*S1
GOSUB Error
GOTO Autoexec
ENDIF
WRITE "SET COM-AND="*S0*"!"
WRITE "DATE!"
WRITE "TIME!"
WRITE "^Z" ; ASCII EOF
FCLOSEO ; Close it
RETURN ; And we're done creating it
;
; AUTOEXEC exists... append SET COM-AND= to the file
; .. note: I don't test for the presence of SHELL or another COM-AND=
;
Auto200:
GOSUB GetSetVal
;
; Create it
;
FOPENO S1 TEXT APPEND ; Open for output - appending at EOF
IF FAILED ; If open failed
S0 = "Error opening "*S1
GOSUB Error
GOTO Autoexec
ENDIF
WRITE "SET COM-AND="*S0*"!"
WRITE "^Z" ; ASCII EOF
FCLOSEO ; Close it
RETURN ; And we're done creating it
;
; Subroutine: GetSETVal (S0 returns value)
;
GetSetVal:
MESS "COM-AND is executing currently from the subdirectory: "
MESS